<script type="text/html" data-help-name="流计数">
    <p>流计数节点：用于对流过该节点的数据流进行计数</p>
</script>
  
  


<script type="text/html" data-template-name="流计数">
    <!-- 设置第一行为Name -->
    <div class="form-row">
      <label for="node-input-name"><i class="fa fa-tag"></i> 名称</label>
      <input type="text" id="node-input-name" data-i18n="[placeholder]name">
  </div>

  <div class="form-row" id="node-set-tick">
    <label>&nbsp;</label>
    <input type="checkbox" id="node-input-set" style="display: inline-block; width: auto; vertical-align: top;">
    <label for="node-input-set" style="width: 70%;">流计数-初始化</label>
  </div>
  <div class="form-row" id="node-set-state">
    <label for="node-input-num_Init">&nbsp;</label>
    <input type="text" id="node-input-num_Init" data-i18n="[placeholder]填入数字">
  </div>
  
  </script>
  
  
  
  <script type="text/javascript">
      RED.nodes.registerType('流计数',{
        category: 'Block 通用节点',
        color: '#35c1f4',
        defaults: {
          name: {value:""},
          set: { value:"" },
          num_Init:  {value:"0", required: true, validate: RED.validators.regex(/^[0-9]*$/)},
        },
        inputs:1,
        outputs:1,
        icon: "font-awesome/fa-plus",
        label: function() {
          return this.name||this._("流计数节点");
        },
        inputLabels: function(i) {
          return this.name||this._("输入-任意流均可触发");
        },
        outputLabels: function(i) {
          return this.name || this._("输出-流计数");
        },


        oneditprepare: function() {

            var setstate = function () {
                if ($('#node-input-set').is(":checked")) {
                    $("#node-set-state").show();
                } else {
                    $("#node-set-state").hide();
                }
            };
            $("#node-input-set").change(function () { setstate(); });
            setstate();
        }
  
      });
    </script>
    
